REM ffmpeg -loop 1 -i "01.PNG" -i "01-02.mp3" -c:v libx264 -c:a aac -b:a 320k -shortest "01-02.mp4"

@echo off
setlocal enabledelayedexpansion

:: Configuration
set "IMAGE_FILE=01.PNG"  :: Your static image file
set "VIDEO_CODEC=libx264"        :: h264 video codec
set "AUDIO_CODEC=aac"            :: aac audio codec
set "CRF=23"                     :: Quality (lower=better, 18-28 recommended)

:: Check requirements
where ffmpeg >nul 2>&1 || (
    echo FFmpeg not found in PATH!
    echo Download from https://ffmpeg.org and add to system PATH
    exit /b 1
)

if not exist "%IMAGE_FILE%" (
    echo Image file "%IMAGE_FILE%" not found!
    exit /b 1
)

:: Process files
for %%A in (*.mp3) do (
    set "input=%%A"
    set "output=%%~nA.mp4"
    
    echo Processing "!input!"...
    
    ffmpeg -y -loop 1 -i "%IMAGE_FILE%" -i "!input!" ^
        -c:v %VIDEO_CODEC% -crf %CRF% ^
        -c:a %AUDIO_CODEC% -b:a 320k ^
        -shortest -pix_fmt yuv420p ^
        "!output!"
    
    if errorlevel 1 (
        echo Error processing "!input!"
    ) else (
        echo Created "!output!"
    )
)

echo Conversion complete!
pause
